IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cms_sp_SiteSelectForHostname]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[cms_sp_SiteSelectForHostname]
GO
create procedure [dbo].[cms_sp_SiteSelectForHostname]
@Hostname varchar(255)
as
select 
	[Sites].[SiteId] as Id,
	[Sites].[SiteGroupId],
	[Sites].[SiteName],
	[Sites].[CreatedBy],
	[Sites].[DateCreated],
	[Sites].[LastUpdatedBy],
	[Sites].[DateLastUpdated]
from [dbo].[Sites] 
	inner join [dbo].[Domains] on [Domains].[SiteId]=[Sites].[SiteId]
where [Domains].[Hostname] = @Hostname

GO

